package org.astri.spitfire.util;

import org.astri.spitfire.entities.History;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Random;

/**
 * <pre>
 *     author : HuGuoDong
 *     e-mail : guodong_hu@126.com
 *     time   : 2018/01/23
 *     desc   :
 *     modified by :
 *     e-mail : xx_xxx@xx
 *     time   :
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class DataUtil {

    private static final String TAG = "DataUtil";


    /**
     * according to prototype, we generate some fake data.
     * generate History data
     * @return historyList
     */
    public static List<History> genFakeHistoryData(){
        List<History> historyList = new ArrayList<>();
        Calendar c  = Calendar.getInstance();
        Random r = new Random();
        r.nextInt();
        for(int i=0; i<100; i++){
            History history = new History();
            history.setReadiness(5 + r.nextInt(5));
            history.setSPO2(90 + r.nextInt(10));
            history.setHR(60+r.nextInt(5));
            history.setHRV(55 + r.nextInt(10));
            history.setGSR(10 + r.nextInt(2));
            history.setExercise("readiness_test");
            c.add(Calendar.DAY_OF_YEAR, -i);
            history.setTestDate(new Date(c.getTimeInMillis()));

            //history.save(); // save data to db

            historyList.add(history);
            LogUtil.d(TAG, history.toString());
        }

        return historyList;
    }

}
